<%@ page import="org.springframework.web.context.request.SessionScope" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%request.setAttribute("ctx", request.getContextPath());%>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui-v2.9.14/css/layui.css">
    <script src="${pageContext.request.contextPath}/layui-v2.9.14/jquery-2.1.0.min.js"></script>
    <script src="${pageContext.request.contextPath}/layui-v2.9.14/layui.js"></script>
    <script src="${pageContext.request.contextPath}/layui-v2.9.14/layui_ext/xmSelect/xm-select.js"></script>
    <script src="${pageContext.request.contextPath}/layui-v2.9.14/crypto-js.js"></script>
    <title>用户列表</title>
</head>
<body>


<h3>报修信息</h3>
工单单号:<span>${order.id}</span><br>
工单分类:<span>${order.orderTypeName}</span><br>
报修小区:<span>${order.communityName}${order.title}</span><br>
报修时间:<span>${order.submitterTime}</span><br>
报修人:<span>${order.submitter}</span><br>
手机号:<span>${order.submitterPhone}</span><br>
工单内容:<span>${order.content}</span><br>
<c:forEach items="${order.images.split(',')}" var="url">
    <img src="${url}" style="width: 60px;height: 60px">
</c:forEach>
<h3>报修处理</h3>
<c:forEach items="${detail}" var="detail">
    ${detail.worker}----${detail.createTime}<br>
    ${detail.content}
    <c:forEach items="${detail.images.split(',')}" var="url">
        <img src="${url}" style="width: 60px;height: 60px">
    </c:forEach>
    <br>
</c:forEach>
<c:forEach items="${pj}" var="pj">
    ${pj.username}---${pj.createTime}<br>
    评价内容:${pj.content}
</c:forEach>
<div>
    <button onclick="ok()">处理完成</button>
</div>
<div style="display: ${order.statusType==3?'':'none'};">
    评价:<input type="text" name="content" id="content">
    <button type="button" onclick="pj()">提交评价</button>
</div>
<script>
    function ok() {

        if (confirm("您确定要提交吗")){
            $.post("/order/ok.do",{orderId:${order.id},submitterPhone:${order.submitterPhone}},function (res) {
                if (res.code==0){
                    alert("处理完成");
                }else {
                    alert("处理失败");
                }
            })
        }
    }
    function pj() {
        $.post("/order/pj.do",{'orderId':${order.id},'content':$("#content").val()},function (res) {
            if (res.code==0){
                alert("评价成功");
                window.location.reload();
            }else {
                alert("评价失败");
            }
        })
    }
</script>
</body>
</html>